home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / emulator / bsvc-1.000 / bsvc-1 / bsvc-1.0.4 / src / Framework / StatInfo.hxx < prev    next >
Text File  |  1995-07-26  |  3KB  |  86 lines

  1. /////////////////////////////////////////////////////////////////////////////// //
  2. // $Id: StatInfo.hxx,v 1.2 1994/09/13 23:23:17 bmott Exp $
  3. /////////////////////////////////////////////////////////////////////////////// //
  4. //
  5. // StatInfo.hxx
  6. //
  7. //   This class is used by BasicCPU (and derived classes) to manage a list of
  8. // of statistics objects.
  9. //
  10. //
  11. // BSVC "A Microprocessor Simulation Framework"
  12. // Copyright (c) 1993
  13. // By: Bradford W. Mott
  14. // December 5,1993
  15. //
  16. ///////////////////////////////////////////////////////////////////////////////
  17. // $Log: StatInfo.hxx,v $
  18. // Revision 1.2  1994/09/13  23:23:17  bmott
  19. // Added public to class declaration of StatisticInformationNode.
  20. //
  21. // Revision 1.1  1994/02/18  19:53:49  bmott
  22. // Initial revision
  23. //
  24. ///////////////////////////////////////////////////////////////////////////////
  25.  
  26. #ifndef STATINFO_HXX
  27. #define STATINFO_HXX
  28.  
  29. #include "BasicCPU.hxx"
  30.  
  31. ///////////////////////////////////////////////////////////////////////////////
  32. // The Statistic Information Class
  33. ///////////////////////////////////////////////////////////////////////////////
  34. class StatisticInformation {
  35.   private:
  36.     char *statistic;    // The statistic (i.e. "Number of reads:  100")
  37.  
  38.   public:
  39.     StatisticInformation(const char* statistic);
  40.     StatisticInformation();
  41.     ~StatisticInformation();
  42.  
  43.     // Set the statistic fields
  44.     void Set(const char* statistic);
  45.  
  46.     inline const char* Statistic()
  47.     { return(statistic); }
  48. };
  49.  
  50.  
  51. ///////////////////////////////////////////////////////////////////////////////
  52. // The Statistical Information List Class
  53. ///////////////////////////////////////////////////////////////////////////////
  54. class StatisticalInformationList {
  55.   private:
  56.     // Class for a linked list of StatisticInformation structures
  57.     class StatisticInformationNode : public StatisticInformation {
  58.       public:
  59.         StatisticInformationNode* next;
  60.  
  61.         StatisticInformationNode(const char* statistic)
  62.             : StatisticInformation(statistic),
  63.               next((void*)0)
  64.         { };
  65.     };
  66.  
  67.     StatisticInformationNode* head;  // Head of the linked list
  68.     StatisticInformationNode* tail;  // Tail of the linked list
  69.     int number_of_elements;          // Number of elements in the list
  70.  
  71.   public:
  72.     StatisticalInformationList(BasicCPU*);
  73.     ~StatisticalInformationList();
  74.  
  75.     // Append an element to the end of the list
  76.     void Append(const char* statistic);
  77.  
  78.     // Return the number of elements in the list
  79.     inline int NumberOfElements()
  80.     { return(number_of_elements); }
  81.  
  82.     // Get the element with the given index (return 1=OK,0=ERROR)
  83.     int Element(int, StatisticInformation&);
  84. };
  85. #endif
  86.